#include <stdio.h>

#include "queue.h"

int main() {
    queue_t queue;
    int i = 0;

    queue_init(&queue);  //队列初始化
    printf("入队顺序\n");
    for(i = 0; i < 5; i++){
        printf("%d ,", i + 1);
        enqueue(&queue, i + 1);
    }
    printf("\n");
    printf("队列长度: %d\n", queue_length(&queue));
    printf("取出队列一个数据：%d\n", dequeue(&queue));
    printf("取出队列一个数据：%d\n", dequeue(&queue));
    printf("队列长度: %d\n", queue_length(&queue));
    printf("销毁队列\n");
    queue_destroy(&queue);

    printf("\n\n\n");
    printf("大小固定的队列测试\n");
    queue_arr_t queue2;

    queue_arr_init(&queue2, 6);
    printf("入队顺序\n");
    for(i = 10; i < 16; i++){
        printf("%d ,", i);
        enqueue_arr(&queue2, i);
    }
    printf("\n");
    if(queue_arr_is_full(&queue2)){
        printf("队列已满\n");
    }else{
        printf("队列未满\n");
    }
    printf("取出队列一个数据：%d\n", dequeue_arr(&queue2));
    printf("取出队列一个数据：%d\n", dequeue_arr(&queue2));
    if(queue_arr_is_full(&queue2)){
        printf("队列已满\n");
    }else{
        printf("队列未满\n");
    }
    printf("队列长度是：%d\n", queue_arr_length(&queue2));
    printf("销毁队列\n");
    queue_arr_destroy(&queue2);
    if(queue_arr_is_empty(&queue2)){
        printf("队列已空\n");
    }else{
        printf("队列未空\n");
    }

    return 0;
}
